package Test;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;

import static sun.misc.Version.print;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-09
 * Time: 19:34
 */
public class Test {
    public static void main(String[] args) {
        while (true) {
            int[] arr = {1,2,3,4,5,6};
            int[] copy = new int[arr.length];
            System.arraycopy(arr,0,copy,2,2);
            System.out.println(Arrays.toString(copy));
        }
        print();
        //int[] arr1 = Arrays.copyOf(arr,arr.length*2);
        //System.out.println(Arrays.toString(arr1));
    }
    public static void main1(String[] args) {
        //int[] arr = {1,2,3,4,5,3,5,7,2,3,5};
        int [] arr = null;
        System.out.println(myToString(arr));
        ArrayList<String> list = new ArrayList();
        list.add("sddddd");
        //list.remove(0);
        list.add("bbbb");
        list.set(1,"hhh");
        list.get(0);
        int length = list.size();
        System.out.println(list);
        System.out.println(length);
    }
    public static String myToString(int[] arr){
        if (arr == null){
            return "[]";
        }
        String str = "[";
        for (int i = 0; i < arr.length; i++) {
            if(i == arr.length - 1){
                str += arr[i];
            }else {
                str = str + arr[i] + ",";
            }
        }
        str += "]";
        return str;
    }
}
